package com.greenline.push.home.controllers.disease;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.greenline.push.core.dto.DiseaseDto;
import com.greenline.push.core.pushcenter.DiseaseManager;

@Controller
@RequestMapping(value = "/disease")
public class DiseaseController {

	@Autowired
	private DiseaseManager diseaseManager;

	@RequestMapping(value = "/{keyword}", method = RequestMethod.GET)
	@ResponseBody
	public String getDiseaseByKeyword(@PathVariable("keyword") String keyword) {
		String id = null;
		List<DiseaseDto> list = diseaseManager.getDiseaseIdByKeyword(keyword);
		if (list != null) {
			id = list.get(0).getUuid();
		}
		return id;
	}
}
